package com.thz.houserental.infrastructure.exception;

import lombok.Data;
import org.springframework.http.HttpStatus;

@Data
public class HttpException extends RuntimeException {
    /**
     * 异常错误码
     */
    public int code;

    /**
     * 异常错误信息
     */
    public String message;

    public HttpException() {
        this.code = HttpStatus.INTERNAL_SERVER_ERROR.value();
        this.message = HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase();
    }
    
    public HttpException(int code) {
        this.code = code;
        this.message = HttpStatus.INTERNAL_SERVER_ERROR.getReasonPhrase();
    }
    
    public HttpException(int code, String message) {
        this.code = code;
        this.message = message;
    }
}
